﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyMainSite2.Data.Repositories;
using MyMainSite2.UI.Web.Models.Shared;

namespace MyMainSite2.UI.Web.Controllers
{
    public class MenuController : Controller
	{
		#region Public Methods

		public PartialViewResult TopMenu()
		{
			var model = new TopMenuModel();

			var menuRepository = MenuRepositoryFactory.Repository;

			var menu = menuRepository.GetTopMenu();

			foreach (var item in menu.tblMenuItems)
			{
				model.Items.Add(new MenuItemModel()
				{
					Text = item.Text,
					Url = item.tblUrl.Url,
				});
			}

			return this.PartialView(model);
		}

		#endregion
	}
}
